package com.pospi.pospihold.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.pospi.pospihold.R;

import java.util.List;

public class PointSelectLeftAdapter extends BaseAdapter {
    private Context context;
    private List<String> leftName;

    public PointSelectLeftAdapter(Context context, List<String> leftName) {
        this.context = context;
        this.leftName = leftName;
    }

    @Override
    public int getCount() {
        return leftName.size();
    }

    @Override
    public Object getItem(int position) {
        return leftName.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            holder = new ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.left_list_item, null);
            holder.left = (TextView) convertView.findViewById(R.id.left_list_item);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.left.setText(leftName.get(position));
        return convertView;
    }

    class ViewHolder {
        TextView left;
    }
}
